<script setup lang="ts">
import { api_url } from '@/api/api'
import { useStandardstore } from '@/stores/standard'

const standardstore = useStandardstore()
const standard = standardstore.standard

function toFile(x: string) {
  window.open(api_url + 'files/' + x)
}
</script>

<template>
  <div class="main">
    <div class="yp">
      <div class="title_sub">
        <span class="text_sub"> 样品 </span>
      </div>
      <div style="display: flex">
        <div>样品信息一览表：</div>
        <el-link
          v-if="standard.sample.photo != ''"
          @click="toFile(standard.sample.informationFile)"
          >{{ standard.sample.informationFile }}</el-link
        >
        <span v-else> 无文件 </span>
      </div>
      <div style="display: flex">
        <div>样品照片：</div>
        <el-link v-if="standard.sample.photo != ''" @click="toFile(standard.sample.photo)">{{
          standard.sample.photo
        }}</el-link>
        <span v-else> 无文件 </span>
      </div>
    </div>
    <div class="sop">
      <div class="title_sub">
        <span class="text_sub"> 检验细则(SOP) </span>
      </div>
      <div style="display: flex">
        <div>检验细则：</div>
        <el-link v-if="standard.sop.file != ''" @click="toFile(standard.sop.file)">{{
          standard.sop.file
        }}</el-link>
        <span v-else> 无文件 </span>
      </div>
    </div>
    <div class="sy">
      <div class="title_sub">
        <span class="text_sub"> 模拟实验 </span>
      </div>
      <div style="display: flex">
        <div>模拟实验报告：</div>
        <el-link
          v-if="standard.simulation.report != ''"
          @click="toFile(standard.simulation.report)"
          >{{ standard.simulation.report }}</el-link
        >
        <span v-else> 无文件 </span>
      </div>
      <div style="display: flex">
        <div>原始记录：</div>
        <el-link
          v-if="standard.simulation.origin != ''"
          @click="toFile(standard.simulation.origin)"
          >{{ standard.simulation.origin }}</el-link
        >
        <span v-else> 无文件 </span>
      </div>
    </div>
  </div>
</template>

<style scoped>
.h2 {
  margin-left: 50px;
  margin-top: 20px;
}
.title_sub {
  border-style: inset;
  border-color: black;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  padding-bottom: 10px;
  margin-right: 50px;
  margin-bottom: 10px;
  margin-top: 10px;
}

.text_sub {
  font-size: 24px;
  font-weight: 800;
}
</style>
